

package gestion_de_mp3.Modeles;
import org.w3c.dom.Node;

class LireXml 
{
    public static void main(String argv[])
    {
       try 
            {
        	javax.xml.parsers.DocumentBuilderFactory factory = 
        	    javax.xml.parsers.DocumentBuilderFactory.newInstance();
        	javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();

    	      	org.w3c.dom.Document d = builder.parse( new java.io.File("listemp3.xml"));
        	
	        org.w3c.dom.NodeList rootChild = d.getChildNodes();
	        org.w3c.dom.Node n=rootChild.item(0);
                System.out.println(n.getNodeName());
	        //if (!n.getNodeName().equals("liste")) {
	    
                org.w3c.dom.NodeList children = n.getChildNodes();
                if ( children != null ) 
                {
                    int len = children.getLength();
                    // read everything except anchors
                    for ( int i = 0; i < len; i++ ) 
                    {
                        Node nn = (Node)children.item(i);
                        System.out.println(nn.getNodeName());
                    
                    //if (nn.getNodeName()=="personne") {
			//Personne p = new Personne(nn);
			//p.sauve();
		    }
		 }
            } 
        catch( Exception e ) {
	    e.printStackTrace();
        }
    }
}

